package com.automobile.dao;

import java.util.List;

import org.apache.ibatis.annotations.CacheNamespace;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import com.automobile.domain.Img;

@Repository
public interface ImgDao {

    @Select("select * from imgList where announceid = #{announceId}")
    List<Img> findImgs(int announceId);

    @Insert("insert into imgList(path,announceid) values(#{path},#{announceId})")
    void save(Img img);

    @Update("update imgList set path = #{path} where id = #{id}")
    void update(Img img);

    @Delete("delete from imgList where id = #{id}")
    void delete(int id);

    @Delete("delete from imgList where announceId = #{announceId}")
    void deleteByAnnounceId(int announceId);


    @Select("select * from imgList where smartId = #{smartId}")
    List<Img> findImgs2(int smartId);

    @Insert("insert into imgList(path,smartId) values(#{path},#{smartId})")
    void save2(Img img);

    @Delete("delete from imgList where smartId = #{smartId}")
    void deleteBySmartId(int smartId);

}